<template>
  <CheckZxProject
    ref="checkZxProjectRef"
    v-if="checkZxProjectVisible"
    @check-success="checkSuccess"
  />
  <CheckXjProject
    ref="checkXjProjectRef"
    v-if="checkXjProjectVisible"
    @check-success="checkSuccess"
  />
  <CheckYfProject
    ref="checkYfProjectRef"
    v-if="checkYfProjectVisible"
    @check-success="checkSuccess"
  />
  <CheckCzProject
    ref="checkCzProjectRef"
    v-if="checkCzProjectVisible"
    @check-success="checkSuccess"
  />
  <CheckSbxm ref="checkSbxmRef" v-if="checkSbxmVisible" @check-success="checkSuccess" />
</template>

<script setup>
import CheckZxProject from "@/views/project/zx/lxxm/components/CheckModal.vue";
import CheckXjProject from "@/views/project/xj/xmlx/components/CheckModal.vue";
import CheckYfProject from "@/views/project/yf/jzhtqd/components/CheckModal.vue";
import CheckCzProject from "@/views/project/yf/czhtqd/components/CheckModal.vue";
import CheckSbxm from "@/views/project/xj/sbxm/sbcl/components/CheckModal.vue";
import { ElMessage } from "element-plus";
const checkZxProjectRef = ref();
const checkXjProjectRef = ref();
const checkYfProjectRef = ref();
const checkCzProjectRef = ref();
const checkSbxmRef = ref();
const checkZxProjectVisible = ref(false);
const checkXjProjectVisible = ref(false);
const checkYfProjectVisible = ref(false);
const checkCzProjectVisible = ref(false);
const checkSbxmVisible = ref(false);
const check = (proId, proClass, processId) => {
  if (proClass == "zXProject") {
    checkZxProjectVisible.value = true;
    nextTick(() => {
      checkZxProjectRef.value.check(proId, processId);
    });
  } else if (proClass == "xJProject") {
    checkXjProjectVisible.value = true;
    nextTick(() => {
      checkXjProjectRef.value.check(proId, processId);
    });
  } else if (proClass == "yfContract") {
    checkYfProjectVisible.value = true;
    nextTick(() => {
      checkYfProjectRef.value.check(proId, processId);
    });
  } else if (proClass == "cZProject") {
    checkCzProjectVisible.value = true;
    nextTick(() => {
      checkCzProjectRef.value.check(proId, processId);
    });
  } else if (proClass == "sbxm") {
    checkSbxmVisible.value = true;
    nextTick(() => {
      checkSbxmRef.value.check(proId, processId);
    });
  } else {
    ElMessage({
      message: "未知的项目类型！",
      type: "error",
    });
  }
};
defineExpose({ check });
const emit=defineEmits(["check-success"]);
const checkSuccess = () => {
  emit("check-success");
};
</script>

<style scoped lang="scss"></style>
